// transformer un yellow bw obtenu par gimp en vrai yellow

import java.awt.Color;
import java.awt.Font;

import ij.IJ;
import ij.ImagePlus;
import ij.gui.NewImage;
import ij.plugin.PlugIn;
import ij.process.ImageProcessor;



public class CopyOfDitherer extends ImagePlus implements PlugIn{
	
	private ImageProcessor primeIP; 
	private int X=2800,Y=2100; // image size
	
	private ImagePlus inverted;  
	private ImageProcessor inv_ip;  
	private ImagePlus inverted0;  
	private ImageProcessor ipMonocol[]=new ImageProcessor[3];  
	
	private int masque[]={0xFF0000,0x00FF00,0x0000FF}; 
	private int decal[]={16,8,0};
	private int col=0; 
	
	public void run(String arg) {
		System.out.println("go");
		
		ImagePlus imp; 


		imp=IJ.openImage("C:/Users/decomite/Pictures/povray/VCS/cmyk/Cyan.png");
		
		imp.setTitle("PrimeIP");
		
	
		System.out.println(imp); 
		primeIP=imp.getProcessor();
		X=primeIP.getWidth(); 
		Y=primeIP.getHeight(); 
		
		
        setStack(null, imp.getStack());
        setCalibration(imp.getCalibration()); 
		
        	show();
		
		
		

		

		
		primeIP.setFont(new Font(null,Font.ITALIC,60));
		primeIP.setColor(Color.RED);
		primeIP.setLineWidth(10); 
		
	
		setProcessor("Verifying", primeIP);
		
	
	
 			inverted = NewImage.createRGBImage ("monamod",X,Y, 1, NewImage.FILL_WHITE);
 			inv_ip = inverted.getProcessor();
 			
 			int copyImage[][]=new int[X][Y]; 
 			
 			
 			
 			for(int i=0;i<X;i++)
 				for(int j=0;j<Y;j++){
 					int colorValue=primeIP.getPixel(i ,j);
 					copyImage[i][j]=colorValue; 
 					int value=colorValue&0X0000FF; 
 					inv_ip.putPixel(i,j,(value+256*value));
 					//System.out.println(((colorValue&0XFF0000)>>16)+" "+((colorValue&0X00FF00)>>8)+" "+ (colorValue&0X0000FF));
 				}
 			
 			
 			
     
 			System.out.println("toto");
 			
 			inverted.show();
 			
 			System.out.println("end !");
	}
	
	
	

}
